//      https://www.nowcoder.com/questionTerminal/43059c624be44c799aae20bf2d066750





#include <iostream>
using namespace std;

int main()
{
    string a, b;
    cin >> a >> b;
    int n = a.size();
    int m = b.size();
    int z = n;
    for (int i = 0; i <= m - n; i++)
    {
        int k = 0;
        for (int j = 0; j < n; j++)
        {
            if (a[j] != b[i + j])
                k++;
        }
        z = min(k, z);
    }
    cout << z << endl;
    return 0;
}